<template>
    <rx-layout>
        <div slot="center" style="padding: 15px">
            <rx-grid
                ref="table"
                :dataSource="dataSource"
                :allowRowSelect="false"
                :multiSelect="false"
                :showPage="false"
                :columns="columns"
            >
                <span slot="success" slot-scope="{ text, record }">
                    <a-tag :color="successMap[text].color">
                        <span>{{ successMap[text].text }}</span>
                    </a-tag>
                </span>
            </rx-grid>
        </div>
    </rx-layout>
</template>

<script>
import {RxFit, RxGrid, Util} from "@lowcode/jpaas-common-lib";

export default {
    name: 'FormLiteFlowLogDetail',
    props: ["logs"],
    components: {
        RxFit,
        RxGrid,
    },
    data() {
        return {
            dataSource: [],
            columns: [
                {
                    title: this.$ti18('rxList.index', '序号'),
                    type: 'indexColumn',
                    width: 60,
                    dataIndex: 'serial',
                    scopedSlots: {customRender: 'serial'}
                },
                {title: this.i18n("nodeName",'节点名'), dataIndex: 'nodeName', width: 80},
                {title: this.i18n("nodeId",'节点Id') , dataIndex: 'nodeId', width: 80},
                {title: this.$comi18('rxDialog.status', '状态'), dataIndex: 'success', width: 60, scopedSlots: {customRender: 'success'}},
                {title: this.i18n('message', '详细信息'), dataIndex: 'message', width: 200},
            ],
            successMap: {
                true: {color: 'green', text: this.i18n('success',"成功")},
                false: {color: 'red', text: this.i18n('fail',"失败")},
            },
        }
    },
    created() {
        if (this.logs) {
            this.dataSource = JSON.parse(this.logs);
        }
    },
    methods: {
        i18n(name,text,key){
            return this.$ti18(name,text,"formLiteFlow",key);
        },
    }
}
</script>
<style scoped>
</style>

